public interface Decimal {

  void release ();

  int cmp (Decimal other);

  Decimal add (Decimal other);

  Decimal sub (Decimal other);

  Decimal mul (Decimal other);

  Decimal div (Decimal other, RoundMode mode);

  Decimal neg ();

  Decimal abs ();

  Decimal pow (int exp);

  Meta meta ();


  class Meta {
    int sign;
    int precision;
    int significant;
    String value;

    @Override
    public boolean equals (Object other) {
      Meta lhs = this;
      Meta rhs = (Meta)other;
      if (lhs.sign != rhs.sign)
        return false;
      if (lhs.precision != rhs.precision)
        return false;
      if (lhs.significant != rhs.significant)
        return false;
      return lhs.value.equals(rhs.value);
    }

    @Override
    public String toString () {
      return String.format("{ sign: %d, precision: %d, significant: %d, value: %s }", sign, precision, significant, value);
    }
  }
}
